package com.polaris.live.utils.sensor.impl

import androidx.appcompat.app.AppCompatActivity
import com.polaris.live.utils.sensor.SensorModuleHelper
import com.polaris.live.utils.sensor.base.DialogModule
import com.polaris.live.utils.sensor.base.IModule
import com.polaris.live.utils.sensor.module.ServerModule

/**
 * 服务切换帮助类
 *
 * @author Created by lucas on 2023/10/25 17:42
 */
class ServerModuleHelper(
    context: AppCompatActivity
) : SensorModuleHelper(context) {

    override fun showSetting(): Boolean {
        val module = object : DialogModule(mContext) {

            override val title: String = "Server Tools"

            override fun createModules(): Array<IModule> = arrayOf(
                ServerModule(mContext)
            )
        }
        module.setOnDismissListener { mIsShowed = false }
        module.runModule()

        return module.isShowDialog()
    }

    companion object {

        fun attach(context: AppCompatActivity): ServerModuleHelper {
            return ServerModuleHelper(context)
        }
    }
}